﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SourceControlEssentials
{
    class Gutsalo : IStudent
    {
        public override int GetHashCode()
        {
            return this.GetLastName().GetHashCode() * this.GetFirstName().GetHashCode() * this.GetGroup();
        }

        public int Id()
        {
            return this.GetHashCode();
        }

        public string GetLastName()
        {
            return "Gutsalo";
        }

        public string GetFirstName()
        {
            return "Oleg";
        }

        public int GetGroup()
        {
            return 318;
        }

        public string MethodName()
        {
            return "Sort chars";
        }

        public string ExecuteStrategy(string value)
        {
            string[] words = value.Split(' ');
            string[] result = new string[words.Length];
            int f = 0;
            foreach(string str in words)
            {
                char[] array = str.ToCharArray();
                for (int i = 0; i < array.Length; i++)
                    for (int j = i; j < array.Length; j++)
                        if (Char.ToLower(array[i]) > Char.ToLower(array[j])) 
                        {
                            char temp = array[i];
                            array[i] = array[j];
                            array[j] = temp;
                        }
                result[f++] = new string(array);
            }
            return string.Join(" ", result);
        }

    }
}
